package leetCode.offer09;


import java.util.ArrayDeque;
import java.util.Queue;
import java.util.Random;

/**
 * 编写测试用例
 */
public class CQueueTest {

    public static void main(String[] args) {
        CQueueRightTest(new CQueueV1());
    }

    /**
     * 正确性测试用例
     * @param cqueue 实现的队列
     */
    public static void CQueueRightTest(CQueue cqueue) {
        Queue<Integer> queue = new ArrayDeque<>();
        boolean testRight = true;
        for(int i=0;i<2000;i++) {
            Random random = new Random();
            if(random.nextBoolean()){
                cqueue.appendTail(i);
                queue.add(i);
            }else{
                if(queue.peek()!=null){
                    if(!queue.poll().equals(cqueue.deleteHead())){
                        System.out.println("比对出错！！");
                        System.out.println(queue);
                        testRight = false;
                        break;
                    }
                }else {
                    if(cqueue.deleteHead()!=-1){
                        System.out.println("比对出错！！");
                        System.out.println(queue);
                        testRight = false;
                        break;
                    }
                }
            }
        }
        if(testRight)
              System.out.println("测试通过！！");
    }

}
